package DataValidatorSchema::Foo;
use strict;
use base qw/ DBIx::Class /;

__PACKAGE__->load_components( qw/ Component::DataValidator Core / );
__PACKAGE__->table( 'foo' );
__PACKAGE__->resultset_class( qw/ DataValidatorSchema::FooResultSet / );


__PACKAGE__->add_columns(
    id => {
        validation => {
            required => 1,
            constraint => qr~^\d+$~
        }
    },
    'name'
);
__PACKAGE__->set_primary_key( qw/ id / );

__PACKAGE__->add_validation_profiles( {
    default => {
        required => [ qw/ name / ],
        constraint_methods => {
            name => sub {
                my ( $df, $value ) = @_;
                return $value =~ /^foo/;
            }
        },
        filters => [ qw/ trim / ]
    }
} );

__PACKAGE__->disable_native_validation( 1 );


1;
